package com.zeroone.star.systemhome.service.impl.meeting;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zeroone.star.project.dto.systemhome.MeetingDTO;
import com.zeroone.star.project.vo.JsonVO;
import com.zeroone.star.project.vo.systemhome.MeetingStatisticsVO;
import com.zeroone.star.systemhome.entity.MtMeeting;
import com.zeroone.star.systemhome.mapper.meeting.MeetingMapper;
import com.zeroone.star.systemhome.service.meeting.MeetingService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * @BelongsProject: oa-java
 * @BelongsPackage: com.zeroone.star.systemhome.service.impl.meeting
 * @Author: dashuai
 * @CreateTime: 2024-11-18  21:49
 * @Description: 会议信息实现类
 * @Version: 1.0
 */
@Service
public class MeetingServiceImpl extends ServiceImpl<MeetingMapper, MtMeeting> implements MeetingService {
    @Resource
    private MeetingMapper meetingMapper;
    @Override
    public List<MeetingDTO> listMyMeetingInfo(String id) {
        LocalDateTime time = LocalDateTime.now();
        List<MeetingDTO> res1 = meetingMapper.selectMeetingInfo(time, id);
        List<MeetingDTO> res2 = meetingMapper.selectInviteMeetingInfo(time,id);
        return Stream.concat(res1.stream(), res2.stream()).collect(Collectors.toList());
    }

    @Override
    public List<MeetingDTO> listInviteMeetingInfo(String id) {
        LocalDateTime time = LocalDateTime.now();
        return meetingMapper.selectInviteMeetingInfo(time,id);
    }

    @Override
    public List<MeetingStatisticsVO> countMeetingInfo(String id) {
       List<MeetingStatisticsVO> res = meetingMapper.countMeetingInfo(id);
        res.stream().forEach(System.out::println);
        return res;
    }
}
